﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Core
{
	public partial class AlphaForm : Form
	{
		private int _startPositionX;
		private int _startPositionY;
		private int _startWidth;
		private int _startHeight;

		private bool isFullScreen = false;

		public AlphaForm()
		{
			InitializeComponent();
		}

		private void AlphaForm_Load(object sender, EventArgs e)
		{
			this.StartPosition = FormStartPosition.Manual;

		}

		private void LoadResources()
		{
//			StringResources
		}

		private void nudInterval_ValueChanged(object sender, EventArgs e)
		{
			if (nudInterval.Value > tbrInterval.Maximum)
				tbrInterval.Maximum *= 2;
			tbrInterval.Value = (int) nudInterval.Value;
		}

		private void tbrInterval_ValueChanged(object sender, EventArgs e)
		{
			nudInterval.Value = (decimal) tbrInterval.Value;
		}

		private void panel1_DoubleClick(object sender, EventArgs e)
		{
			SwitchFullScreen();
		}

		private void SwitchFullScreen()
		{
			if (this.FormBorderStyle != FormBorderStyle.None)
			{
				_startPositionX = this.Location.X;
				_startPositionY = this.Location.Y;
				_startWidth = this.Width;
				_startHeight = this.Height;

				this.FormBorderStyle = FormBorderStyle.None;
				this.Location = new Point(0, 0);
				this.Size = Screen.PrimaryScreen.Bounds.Size;

				grpOptions.Visible = false;

				isFullScreen = true;
			}
			else
			{
				this.FormBorderStyle = FormBorderStyle.Sizable;
				this.Location = new Point(_startPositionX, _startPositionY);
				this.Width = _startWidth;
				this.Height = _startHeight;

				grpOptions.Visible = true;

				isFullScreen = false;
			}
		}

		private void panel1_MouseHover(object sender, EventArgs e)
		{
			if (isFullScreen)
				grpOptions.Visible = false;
		}

		private void pnlOptions_MouseHover(object sender, EventArgs e)
		{
			if (isFullScreen)
				grpOptions.Visible = true;
		}
	}
}
